package com.xiaohao.simple
import android.os.CountDownTimer
import android.view.View
import com.xiaohao.simple.empty.LoadHelper
import com.xiaohao.statelayout.BaseActivity
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : BaseActivity() {

    private lateinit var timer:CountDownTimer

    override fun initView() {
        initEmpty(object : LoadHelper.EmptyClickListener{
            override fun reload() {
                showContents()
            }
        })
        showContents()
        btnEmpty.setOnClickListener {showEmpty()}
        btnError.setOnClickListener {showError()}
    }

    override fun getLayoutId(): Int {
       return R.layout.activity_main
    }

    override fun getContentView():View{
        return  content
    }

    private fun showContents(){
        timer=object:CountDownTimer(1000,1000){
            override fun onFinish() {
                showContent()
            }
            override fun onTick(millisUntilFinished: Long) { }
        }.start()
    }

}
